package com.catersystem.zmy.catersystem.httputils;

import android.app.ProgressDialog;
import android.content.Context;
import android.util.Log;

import com.catersystem.zmy.catersystem.finals.FinalUrl;
import com.catersystem.zmy.catersystem.utils.DialogUtil;

import java.util.Map;

/**
 * Created by Administrator on 2017/11/22 0022.
 */

public class GetDataUtils {
    private static GetDataUtils mGetDataUtils;

    public static GetDataUtils getInstance() {
        if (mGetDataUtils == null) {
            mGetDataUtils = new GetDataUtils();
        }
        return mGetDataUtils;
    }

    /**
     * 获取按菜分类的菜品信息
     *
     * @param data
     * @param context
     * @param httpResult
     */
    public void getDishData(Map<String, String> data, Context context, boolean isShow, HttpUtils.IHttpResult
            httpResult) {
        ProgressDialog progressDialog = DialogUtil.getProgressDialog(context, "获取中...");
        HttpUtils httpUtils = new HttpUtils(context, progressDialog, isShow);
        httpUtils.getApi(FinalUrl.getDishData(), data, httpResult);
    }

    /**
     * 更新按菜分类的菜品烹饪状态
     *
     * @param data
     * @param context
     * @param httpResult
     */
    public void refreshCookingStatus(Map<String, String> data, Context context, HttpUtils.IHttpResult httpResult) {
        ProgressDialog progressDialog = DialogUtil.getProgressDialog(context, "更新中...");
        HttpUtils httpUtils = new HttpUtils(context, progressDialog);
        httpUtils.getApi(FinalUrl.refreshCookingStatus(), data, httpResult);
    }

    ;

    /**
     * 获取按单分类的菜品信息
     *
     * @param data
     * @param context
     * @param httpResult
     */
    public void getAllDishData(Map<String, String> data, Context context, boolean isShow, HttpUtils.IHttpResult
            httpResult) {
        ProgressDialog progressDialog = DialogUtil.getProgressDialog(context, "更新中...");
        HttpUtils httpUtils = new HttpUtils(context, progressDialog, isShow);
        httpUtils.getApi(FinalUrl.getAllDishesData(), data, httpResult);
    }

    /**
     * 更新按单分类的菜品信息
     *
     * @param data
     * @param context
     * @param httpResult
     */
    public void refreshAllDishData(Map<String, String> data, Context context, HttpUtils.IHttpResult httpResult) {
        ProgressDialog progressDialog = DialogUtil.getProgressDialog(context, "更新中...");
        HttpUtils httpUtils = new HttpUtils(context, progressDialog, true);
        httpUtils.getApi(FinalUrl.refreshAllDishesData(), data, httpResult);
    }

    /**
     * 获取当天所有菜品的状态
     *
     * @param data
     * @param context
     * @param httpResult
     */
    public void getDishesStatus(Map<String, String> data, Context context, HttpUtils.IHttpResult httpResult) {
        ProgressDialog progressDialog = DialogUtil.getProgressDialog(context, "更新中...");
        HttpUtils httpUtils = new HttpUtils(context, progressDialog, false);
        httpUtils.getApi(FinalUrl.getDishesStatus(), data, httpResult);
    }

    ;
}
